/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Views.Students;

import Controllers.Controller_MainWindow;

/**
 *
 * @author Cristea
 */
public class FrmStudentsMain extends javax.swing.JFrame {

    Controller_MainWindow _controller;
    /**
     * Creates new form FrmStudentsMain
     */
    public FrmStudentsMain(Controller_MainWindow controller) {
        SetLookAndFell();//if crash => delete the method
        initComponents();
        _controller = controller;
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        takeTestJRadioButton = new javax.swing.JRadioButton();
        enrolllInCoursesJButton = new javax.swing.JButton();
        viewScheduledCoursesButton = new javax.swing.JButton();
        viewGradesJButton = new javax.swing.JButton();
        downloadCourseMaterialJButton = new javax.swing.JButton();
        downloadAssignmentsJButton = new javax.swing.JButton();
        uploadAssignmentsButton = new javax.swing.JButton();
        takeTestJButton = new javax.swing.JButton();

        takeTestJRadioButton.setText("Take test");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Students - Main Menu");

        enrolllInCoursesJButton.setText("Enroll in courses");
        enrolllInCoursesJButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                enrolllInCoursesJButtonMouseClicked(evt);
            }
        });

        viewScheduledCoursesButton.setText("View scheduled courses");
        viewScheduledCoursesButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                viewScheduledCoursesButtonMouseClicked(evt);
            }
        });

        viewGradesJButton.setText("View grades");
        viewGradesJButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                viewGradesJButtonMouseClicked(evt);
            }
        });

        downloadCourseMaterialJButton.setText("Download course material");
        downloadCourseMaterialJButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                downloadCourseMaterialJButtonMouseClicked(evt);
            }
        });

        downloadAssignmentsJButton.setText("Download assignments");
        downloadAssignmentsJButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                downloadAssignmentsJButtonMouseClicked(evt);
            }
        });

        uploadAssignmentsButton.setText("Upload assignments");
        uploadAssignmentsButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                uploadAssignmentsButtonMouseClicked(evt);
            }
        });

        takeTestJButton.setText("Take test");
        takeTestJButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                takeTestJButtonMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(46, 46, 46)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(enrolllInCoursesJButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(viewScheduledCoursesButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(viewGradesJButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(downloadCourseMaterialJButton, javax.swing.GroupLayout.DEFAULT_SIZE, 232, Short.MAX_VALUE)
                    .addComponent(uploadAssignmentsButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(downloadAssignmentsJButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(takeTestJButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(39, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addComponent(enrolllInCoursesJButton)
                .addGap(18, 18, 18)
                .addComponent(viewScheduledCoursesButton)
                .addGap(18, 18, 18)
                .addComponent(viewGradesJButton)
                .addGap(18, 18, 18)
                .addComponent(downloadCourseMaterialJButton)
                .addGap(18, 18, 18)
                .addComponent(downloadAssignmentsJButton)
                .addGap(18, 18, 18)
                .addComponent(uploadAssignmentsButton)
                .addGap(18, 18, 18)
                .addComponent(takeTestJButton)
                .addContainerGap(32, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void enrolllInCoursesJButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_enrolllInCoursesJButtonMouseClicked
        // TODO add your handling code here:
//        FrmEnrollInCourses enroll= new FrmEnrollInCourses();
//        enroll.setVisible(true);
        _controller.EnrollmentToCourses();
    }//GEN-LAST:event_enrolllInCoursesJButtonMouseClicked

    private void viewScheduledCoursesButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_viewScheduledCoursesButtonMouseClicked
        // TODO add your handling code here:
//        FrmScheduledCourses sched=new FrmScheduledCourses();
//        sched.setVisible(true);
        _controller.ViewScheduledCourses();
    }//GEN-LAST:event_viewScheduledCoursesButtonMouseClicked

    private void viewGradesJButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_viewGradesJButtonMouseClicked
        // TODO add your handling code here:
//        FrmViewGrades grade=new FrmViewGrades();
//        grade.setVisible(true);
        _controller.ViewGrades();
    }//GEN-LAST:event_viewGradesJButtonMouseClicked

    private void downloadCourseMaterialJButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_downloadCourseMaterialJButtonMouseClicked
        // TODO add your handling code here:
//        FrmDownloadCourseMaterial com=new FrmDownloadCourseMaterial();
//        com.setVisible(true);
        _controller.DownloadCourses();
    }//GEN-LAST:event_downloadCourseMaterialJButtonMouseClicked

    private void downloadAssignmentsJButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_downloadAssignmentsJButtonMouseClicked
        // TODO add your handling code here:
//        FrmDownloadAssignments doa=new FrmDownloadAssignments();
//        doa.setVisible(true);
        _controller.DownloadAssignments();
    }//GEN-LAST:event_downloadAssignmentsJButtonMouseClicked

    private void uploadAssignmentsButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_uploadAssignmentsButtonMouseClicked
        // TODO add your handling code here:
//        FrmUploadAssignment up=new FrmUploadAssignment();
//        up.setVisible(true);
        _controller.UploadAssignments();
    }//GEN-LAST:event_uploadAssignmentsButtonMouseClicked

    private void takeTestJButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_takeTestJButtonMouseClicked
        // TODO add your handling code here:
//        FrmTakeTest test= new FrmTakeTest();
//        test.setVisible(true);
        _controller.TakeTest();
    }//GEN-LAST:event_takeTestJButtonMouseClicked

    /**
     * @param args the command line arguments
     */
    //public static void main(String args[]) {
    private void SetLookAndFell()
    {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(FrmStudentsMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(FrmStudentsMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(FrmStudentsMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(FrmStudentsMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton downloadAssignmentsJButton;
    private javax.swing.JButton downloadCourseMaterialJButton;
    private javax.swing.JButton enrolllInCoursesJButton;
    private javax.swing.JButton takeTestJButton;
    private javax.swing.JRadioButton takeTestJRadioButton;
    private javax.swing.JButton uploadAssignmentsButton;
    private javax.swing.JButton viewGradesJButton;
    private javax.swing.JButton viewScheduledCoursesButton;
    // End of variables declaration//GEN-END:variables
}
